package cn.com.xyc.test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;

public class FileDown {
	public static void main(String[] args) {
		try {
			URL url = new URL("");
			InputStream is = null;
			is = url.openStream();
			OutputStream os = null;
			File f=new File("D:\\filedown\\");
			f.mkdir();
			os=new FileOutputStream("D:\\filedown\\aaa.jpg");
			int bytesRead=0;
			byte buffer[]=new byte[8192];
			while ((bytesRead=is.read(buffer,0,8192))!=-1){
				os.write(buffer,0,bytesRead);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
